package com.mybatisplus.sunpineshop.controller;


import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.*;

/**
 * <p>
 *  咨询信息API
 * </p>
 *
 * @author jobob
 * @since 2020-12-29
 */
@RestController
@RequestMapping("/news")
@CrossOrigin
public class NewsApiController {
    /**
     * @Author GongXl
     * @Description 获得猿区生活菜单类型列表
     * @Date 2021/2/18 11:31
     * @Param []
     * @return java.util.List<java.util.Map>
     *
     **/
    @RequestMapping("/getNewsList")
    public List<Map> getNewsList(){
        List<Map>  list = new ArrayList<Map>();
        for (int i = 4; i < 100; i++) {
            Map temp = new HashMap();
            temp.put("id",i);
            temp.put("title","J2EE视频"+i);
            temp.put("img_url","../../static/imgs/javaee_qr.png");
            temp.put("date",new Date());
            temp.put("total",i);
            temp.put("content","内容介绍"+i);
            list.add(temp);
        }
        return list;
    }
    @RequestMapping("/getNewsDetailList")
    public List<Map> getNewsDetailList(String id){
        List<Map>  list = new ArrayList<Map>();
        Map temp = new HashMap();
        temp.put("id",id);
        temp.put("pubTime",new Date());
        temp.put("viewCount",22);
        temp.put("title","J2EE视频");
        temp.put("content","测试<br/>内容<img src='/static/imgs/ruoyi_index.png'/>");
        list.add(temp);
        return list;
    }
}

